home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / prog / lvswin.zip / WIN.H < prev    next >
C/C++ Source or Header  |  1991-10-23  |  9KB  |  358 lines

  1. /* Copyright 1991 (c),   Lake View Software
  2.                          4321 Harborough Rd.
  3.                          Columbus, OH 43220
  4. */
  5.  
  6. #ifndef WIN_H
  7. #define WIN_H
  8.  
  9. /*
  10.  * Type defs
  11.  */
  12. typedef void (*bk_func)(void);
  13. typedef void (*key_func)(void);
  14. typedef void (*display_atst) (int ,int, char *,char *, int);
  15. typedef void (*display_ch)   (int,int,int,char);
  16.  
  17. /*
  18.  * Misc low level screen functions
  19.  */
  20. void Win_init (int mode);
  21. int *Win_save (int, int, int, int);
  22. void Win_restore (int, int, int, int, int *);
  23. void Win_clrscr ();
  24. int Win_setpage (int page);
  25. int Win_getpage ();
  26. void Win_bios (int mode);
  27. void Win_snow (int mode);
  28. void Win_mono (int mode);
  29. int Win_currentmode ();
  30. void Win_dispst (int y, int x, int color, char *str, int count);
  31. void Win_gotoxy (int y,int x);
  32. void Win_getxy (int *y,int *x);
  33. void Win_drawbox (int sr, int sc, int er, int ec, int color, int type);
  34. void Win_hidecur ();
  35. void Win_showcur ();
  36. int Win_map_attr (int attr);
  37. long pow_10 (int i);
  38. double dround (double d, int dec);
  39. void Win_beep ();
  40. void Win_delayticks (int ticks);
  41. extern display_atst Win_dispatst;
  42. extern display_ch   Win_dispch;
  43.  
  44. /*
  45.  * Keyboard functions
  46.  */
  47. int Win_lastkey();                   /* return the last key pressed */
  48. int Win_keystuf (int key);
  49. int Win_getkey (int seconds);
  50. void Win_setbkloop (bk_func func);
  51. void Win_setonkey (int key, key_func func);
  52.  
  53. /*
  54.  * Information functions
  55.  */
  56. int Win_Max_x ();           /* Max screen x coordinate */
  57. int Win_Max_y ();           /* Max screen y coordinate */
  58.  
  59. /*
  60.  * Control functions
  61.  */
  62. void Win_setcols (int cols);
  63. void Win_setrows (int rows);
  64. int Win_settabsize (int size);
  65.  
  66. /*
  67.  * String functions 
  68.  */
  69. char *strfill (char ch,int cnt);
  70. char *strtrim (char *str);
  71. char *str_setsz (char *str,int len);
  72. char *str_clear (char *str,int len);
  73. char *cut_spaces (char *str);
  74. int is_in (char ch,char *str);
  75.  
  76. /*
  77.  * VGA functions
  78.  */
  79.  
  80. int VGA_videotype ();
  81. int VGA_setlines (int lines);  /* Set number of screen lines 25/50 */
  82. int VGA_blinkstate ();      /* return state of blink */
  83. int VGA_setblink (int on_off);
  84. int VGA_fontload ();
  85. extern "C" {
  86.     void far VGA_Fload_16 ();    /* Carefull */
  87.     void far VGA_Fload_14 ();    /* Carefull */
  88.     void far VGA_Fload_8 ();     /* Carefull */
  89. };
  90.  
  91. /*
  92.  * Scroll display characters
  93.  */
  94.  
  95. #define RIGHT_ARROW_CHAR   ((char)0x10)
  96. #define LEFT_ARROW_CHAR    ((char)0x11)
  97. #define UP_ARROW_CHAR      ((char)0x1e)
  98. #define DOWN_ARROW_CHAR    ((char)0x1f)
  99. #define SCROLL_FILL_CHAR   ((char)0xb0)
  100. #define SCROLL_ELEV_CHAR   ((char)0xdb)
  101.  
  102. /*
  103.  * Video types
  104.  */
  105. #define V_VGA       1
  106. #define V_MCGA      2
  107. #define V_EGA       3
  108. #define V_CGA       4
  109. #define V_MONO      5
  110.  
  111. /*
  112.  * Global Variables 
  113.  */
  114. extern char *Box_char[];                /* in win_box.cpp */
  115.  
  116. /* 
  117.  * PC Info Functions 
  118.  */
  119. int Share_Loaded ();
  120. int Print_Loaded ();
  121. int Assign_Loaded ();
  122. int Himem_Loaded ();
  123. int Novel_Loaded ();
  124.  
  125. /* 
  126.  * Wait for retrace to suppress cga snow 
  127.  */
  128. #define waithret()          while((inp(0x03da)&0x01)!=0); \
  129.                             while((inp(0x03da)&0x01)==0)
  130. #define waitvret()          while((inp(0x03da)&0x08)!=0); \
  131.                             while((inp(0x03da)&0x08)==0)
  132.  
  133. /*
  134.  * Display Segments
  135.  */
  136. #define COLOR_SEG 0xb800
  137. #define MONO_SEG  0xb000
  138.  
  139. /* 
  140.  * Window init modes 
  141.  */
  142. #define W_DEFAULT 0
  143. #define W_MONO    1     /* Remap colors to mono */
  144. #define W_BIOS    2     /* BIOS video writes */
  145. #define W_SNOW    4     /* CGA snow suppression */
  146. #define W_NOCLEAR 8     /* don't clear the screen with init */
  147.  
  148. /* 
  149.  * Get Key Modes 
  150.  */
  151. #define W_NOECHO 0
  152. #define W_ECHO   1
  153.  
  154. /* 
  155.  * Title postions 
  156.  */
  157. #define W_CENTER    0
  158. #define W_LEFT      1
  159. #define W_RIGHT     2
  160.  
  161. /* 
  162.  * Window Border Definitions 
  163.  */
  164. #define W_NOBORDER 0
  165. #define W_SPACES   1
  166. #define W_DOUBLE   2
  167. #define W_SINGLE   3
  168. #define W_DOUSIN   4
  169. #define W_SOLID    5
  170. #define W_SINDOU   6
  171. #define MAX_BOX_TYPE  6
  172. void Win_Load_Alt_Border ();    /* vga graphics only */
  173. void Win_Load_Alt_Box ();    /* vga graphics only */
  174.  
  175. /* 
  176.  * Window function return codes 
  177.  */
  178. #define W_OK       0
  179. #define W_ERROR   -1
  180. #define W_NOTOPEN -3
  181. #define W_OPENED  -4
  182. #define W_NOTINIT -5
  183. #define W_NOMEM   -6
  184. #define W_ESCAPE  -27
  185.  
  186. /* 
  187.  * Window misc 
  188.  */
  189. #define W_ON    1
  190. #define W_OFF   0
  191.  
  192. /* 
  193.  * Some Colors 
  194.  */
  195. #ifndef BLACK
  196. #define BLACK       0                   
  197. #define BLUE        1
  198. #define GREEN       2
  199. #define CYAN        3
  200. #define RED         4
  201. #define MAGENTA     5
  202. #define BROWN       6
  203. #define YELLOW      14
  204. #define WHITE       15
  205. #endif
  206. #define LGREY       7
  207. #define DGREY       8
  208. #define LBLUE       9
  209. #define LGREEN      10
  210. #define LCYAN       11
  211. #define LRED        12
  212. #define LMAGENTA    13
  213. #define _BLACK      0
  214. #define _BLUE       16
  215. #define _GREEN      32
  216. #define _CYAN       48
  217. #define _RED        64
  218. #define _MAGENTA    80
  219. #define _BROWN      96
  220. #define _LGREY      112
  221. /*
  222.  * VGA highlighted background colors
  223.  */
  224. #define _DGREY      (8*16)
  225. #define _LBLUE      (9*16)
  226. #define _LGREEN     (10*16)
  227. #define _LCYAN      (11*16)
  228. #define _LRED       (12*16)
  229. #define _LMAGENTA   (13*16)
  230. #define _YELLOW     (14*16)
  231. #define _WHITE      (15*16)
  232.  
  233. /* 
  234.  * Printer attributes   Can be ored together if you printer can handle it 
  235.  */
  236. #define P_UNDERLINE    1
  237. #define P_BOLD            2
  238. #define P_COMPRESS    4
  239. #define P_NORMAL        8
  240.  
  241. /* 
  242.  * Some keyboard ascii/scan values 
  243.  */
  244. #define   BACK_SPACE   0x0e08
  245. #define   TAB          0x0f09
  246. #define   ESC          0x011B
  247. #define   ENTER        0x1c0d
  248. #define   HOME         0x4700
  249. #define   END          0x4F00
  250. #define   PGUP         0x4900
  251. #define   PGDN         0x5100
  252. #define   UP           0x4800
  253. #define   DOWN         0x5000
  254. #define   RIGHT        0x4D00
  255. #define   LEFT         0x4B00
  256. #define   SHIFT_TAB    0x0F00
  257. #define   SHIFT_UP     0x4838
  258. #define   SHIFT_DOWN   0x5032
  259. #define   SHIFT_RIGHT  0x4d36
  260. #define   SHIFT_LEFT   0x4b34
  261. #define   INS          0x5200
  262. #define   DEL          0x5300
  263. #define   CTRL_HOME    0x7700
  264. #define   CTRL_END     0x7500
  265. #define   CTRL_PGUP    0x8400
  266. #define   CTRL_PGDN    0x7600
  267. #define   CTRL_RIGHT   0x7400
  268. #define   CTRL_LEFT    0x7300
  269. #define   ALT_1        0x7800
  270. #define   ALT_2        0x7900
  271. #define   ALT_3        0x7A00
  272. #define   ALT_4        0x7B00
  273. #define   ALT_5        0x7C00
  274. #define   ALT_6        0x7D00
  275. #define   ALT_7        0x7E00
  276. #define   ALT_8        0x7F00
  277. #define   ALT_9        0x8000
  278. #define   ALT_0        0x8100
  279. #define   ALT_MINUS    0x8200
  280. #define   ALT_EQUAL    0x8300
  281. #define   ALT_Q        0x1000
  282. #define   ALT_W        0x1100
  283. #define   ALT_E        0x1200
  284. #define   ALT_R        0x1300
  285. #define   ALT_T        0x1400
  286. #define   ALT_Y        0x1500
  287. #define   ALT_U        0x1600
  288. #define   ALT_I        0x1700
  289. #define   ALT_M        0x3200
  290. #define   ALT_O        0x1800
  291. #define   ALT_P        0x1900
  292. #define   ALT_A        0x1E00
  293. #define   ALT_S        0x1F00
  294. #define   ALT_D        0x2000
  295. #define   ALT_F        0x2100
  296. #define   ALT_G        0x2200
  297. #define   ALT_H        0x2300
  298. #define   ALT_J        0x2400
  299. #define   ALT_K        0x2500
  300. #define   ALT_L        0x2600
  301. #define   ALT_Z        0x2C00
  302. #define   ALT_X        0x2D00
  303. #define   ALT_C        0x2E00
  304. #define   ALT_V        0x2F00
  305. #define   ALT_B        0x3000
  306. #define   ALT_N        0x3100
  307. #define   ALT_M        0x3200
  308. #define   F1           0x3B00
  309. #define   F2           0x3C00
  310. #define   F3           0x3D00
  311. #define   F4           0x3E00
  312. #define   F5           0x3F00
  313. #define   F6           0x4000
  314. #define   F7           0x4100
  315. #define   F8           0x4200
  316. #define   F9           0x4300
  317. #define   F10          0x4400
  318. #define   CTRL_F1      0x5E00
  319. #define   CTRL_F2      0x5F00
  320. #define   CTRL_F3      0x6000
  321. #define   CTRL_F4      0x6100
  322. #define   CTRL_F5      0x6200
  323. #define   CTRL_F6      0x6300
  324. #define   CTRL_F7      0x6400
  325. #define   CTRL_F8      0x6500
  326. #define   CTRL_F9      0x6600
  327. #define   CTRL_F10     0x6700
  328. #define   CTRL_A       0x1e01
  329. #define   CTRL_B       0x3002
  330. #define   CTRL_C       0x2e03
  331. #define   CTRL_D       0x2004
  332. #define   CTRL_I       0x1709
  333. #define   CTRL_X       0x2d18
  334. #define   CTRL_Y       0x1519
  335. #define   CTRL_Z       0x2c1a
  336. #define   SHIFT_F1     0x5400
  337. #define   SHIFT_F2     0x5500
  338. #define   SHIFT_F3     0x5600
  339. #define   SHIFT_F4     0x5700
  340. #define   SHIFT_F5     0x5800
  341. #define   SHIFT_F6     0x5900
  342. #define   SHIFT_F7     0x5A00
  343. #define   SHIFT_F8     0x5B00
  344. #define   SHIFT_F9     0x5C00
  345. #define   SHIFT_F10    0x5D00
  346. #define   ALT_F1       0x6800
  347. #define   ALT_F2       0x6900
  348. #define   ALT_F3       0x6A00
  349. #define   ALT_F4       0x6B00
  350. #define   ALT_F5       0x6C00
  351. #define   ALT_F6       0x6D00
  352. #define   ALT_F7       0x6E00
  353. #define   ALT_F8       0x6F00
  354. #define   ALT_F9       0x7000
  355. #define   ALT_F10      0x7100
  356.  
  357. #endif    /* ndef win_h */
  358.